Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse app config strictly by default #3629

Merged
merged 2 commits into from
Feb 12, 2025
Merged

Conversation

saquibmian
Copy link
Contributor

@saquibmian saquibmian commented Feb 11, 2025

In #3376 we switched ReadConfig from UnmarshalYAMLStrict to UnmarshalYAMLNonStrict. This was to enable a use case in an internal application. This PR switches ReadConfig back to UnmarshalYAMLStrict and adds ReadConfigNonStrict to enable the non-strict use case. The internal application will document why it needs the non-strict property.

I verified that nothing in the CLI needs non-strict parsing, everything is using the CLI's NameContainer and reads bufapp.Config.

In #3376 we switched `UnmarshalYAMLStrict` to `UnmarshalYAMLNonStrict`.
I'm not entirely sure if this was intentional, but we want this to be
strict by default. Happy to discuss if the CLI needs non-strict anywhere
and if so if we can make this configurable.
Copy link
Contributor

github-actions bot commented Feb 11, 2025

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 12, 2025, 4:15 PM

@bufdev
Copy link
Member

bufdev commented Feb 11, 2025

If we did it in that PR it was definitely intentional, that PR was unfortunately massive but I would not just revert this without understanding a bit more why or why not

@saquibmian
Copy link
Contributor Author

If we did it in that PR it was definitely intentional

Yup that's why I opened the PR to discuss if this was intentional. I have poked around a little and can't see yet why we would do this, wondering if you can recall why we did this?

@mfridman
Copy link
Member

mfridman commented Feb 11, 2025

I also cannot recall why. Maybe we could add a ReadConfigStrict or a functional option to control the default behavior?

In other internal projects, we'd like to use strict unmarshal. It's a property we'd like to maintain to avoid config issues.

@saquibmian saquibmian changed the title Parse app config strictly Parse app config strictly by default Feb 12, 2025
Copy link
Member

@mfridman mfridman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me to have ReadConfig be strict by default and offer a way to use non-strict.

No opinion whether it should be a separate function or a functional option.

Copy link
Member

@doriable doriable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @mfridman's thoughts on the options, stamping!

@saquibmian saquibmian merged commit ea3dec9 into main Feb 12, 2025
18 checks passed
@saquibmian saquibmian deleted the smian/strict-yaml-parsing branch February 12, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants